<template>
  <div class="left-top">
    <div class="title">
      <div class="title-left">
        <!--<span>
          <img src="../../assets/par.png" alt="" />
        </span>-->
        <span class="name">惠选交易金额</span>
      </div>
      <div class="title-right">{{ orderData.total_amount }}</div>
    </div>
    <div class="table">
      <span></span>
      <span>充值账户</span>
      <span>充值时间</span>
      <span>购买金额</span>
    </div>
    <div class="table-two" ref="tableColumn">
      <div
        class="table-column"
        v-for="(item, index) in orderData.list"
        :key="index"
      >
        <span>{{ item.title }}</span>
        <span class="color">{{ item.acount }}</span>
        <span>{{ item.time }}</span>
        <span class="color">{{ item.amount }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    orderData: {
      type: Object,
      default: () => {},
    },
  },
  mounted() {
    setInterval(() => {
      const scrollTop = this.$refs.tableColumn.scrollTop;
      const scrollHeight = this.$refs.tableColumn.scrollHeight;
      const clientHeight = this.$refs.tableColumn.clientHeight;
      if (clientHeight >= scrollHeight - scrollTop) {
        this.$refs.tableColumn.scrollTop = 0;
      } else {
        this.$refs.tableColumn.scrollTop += 1;
      }
    }, 50);
  },
};
</script>

<style scoped lang="less">
.left-top {
  height: 100%;
  overflow: hidden;
  .title {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    margin: 16px 20px 10px;
    .title-left {
      font-size: 20px;
      span:first-child {
        display: flex;
        align-items: center;
      }
      .name::before {
        content: "";
        width: 20px;
        height: 20px;
        background-color: url("../../assets/par.png");
      }
    }
    .title-right {
      font-weight: bold;
    }
  }
  .table {
    display: flex;
    padding-bottom: 2px;
    span {
      font-size: 14px;
      flex: 1;
      text-align: center;
    }
  }
  .table-two {
    height: calc(100% - 96px);
    overflow: auto;
    &:hover {
      cursor: pointer;
    }
  }
  .table-column {
    display: flex;
    padding: 8px 0;
    font-size: 14px;
    span {
      flex: 1;
      text-align: center;
    }
    .color {
      color: #1ec4ff;
    }
  }
}
</style>
